package guoanmaker.operator.business.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import guoanmaker.operator.business.model.ProvideCommodityServiceRange;


public interface ProvideCommodityServiceRangeRepository  extends  JpaRepository<ProvideCommodityServiceRange, String>, JpaSpecificationExecutor<ProvideCommodityServiceRange>{
	
	@Query("select s from ProvideCommodityServiceRange s left join  s.commodity c where  c.id=s.commodity.id  and  c.id=:id")
	public  List<ProvideCommodityServiceRange>    selectByServerArea(@Param("id") String id);
	/**
	 * lihongyu
	* @Title: selectBycityandid 
	* @Description: TODO(这里用一句话描述这个方法的作用) 
	* @param id
	* @param cityId
	* @return    设定文件 
	* @return List<ProvideCommodityServiceRange>    返回类型 
	* @throws 
	 */
	@Query("select s from ProvideCommodityServiceRange s where s.city.id=:cityId and s.commodity.id=:id")
	public  List<ProvideCommodityServiceRange>    selectBycityandid(@Param("id") String id,@Param("cityId") String cityId);
	
	@Query("select s from ProvideCommodityServiceRange s  left join s.city c  left join s.commodity t  where c.code=:citycode and t.id=:id")
	public  List<ProvideCommodityServiceRange>    selectBycitycodeandid(@Param("citycode") String citycode,@Param("id") String id);
	

}
